home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / alangsbs.zip / EAT2.ASM < prev    next >
Assembly Source File  |  1989-12-27  |  3KB  |  89 lines

  1. ;---------------------------------------------------------------
  2. ;                             EAT2.ASM
  3. ;          Backhanded advertising program, with procedures
  4. ;
  5. ;                                      by Jeff Duntemann
  6. ;                                      MASM/TASM
  7. ;                                      Last update 12/27/89
  8. ;---------------------------------------------------------------
  9.  
  10. ;----------------------------|
  11. ;    BEGIN STACK SEGMENT     |
  12. ;----------------------------|
  13. MyStack    SEGMENT STACK        ; STACK word ensures loading of SS by DOS
  14.  
  15.            DB      64 DUP ('STACK!!!') ; This reserves 512 bytes for the stack
  16.  
  17. MyStack    ENDS
  18. ;----------------------------|
  19. ;     END STACK SEGMENT      |
  20. ;----------------------------|
  21.  
  22.  
  23. ;----------------------------|
  24. ;     BEGIN DATA SEGMENT     |
  25. ;----------------------------|
  26. MyData     SEGMENT
  27.  
  28. Eat1       DB      "Eat at Joe's...",'$'
  29. Eat2       DB      "...ten million flies can't ALL be wrong!",'$'
  30. CRLF       DB      0DH,0AH,'$'
  31.  
  32. MyData     ENDS
  33. ;----------------------------|
  34. ;      END DATA SEGMENT      |
  35. ;----------------------------|
  36.  
  37. ;----------------------------|
  38. ;     BEGIN CODE SEGMENT     |
  39. ;----------------------------|
  40. MyCode     SEGMENT
  41.  
  42.            assume CS:MyCode,DS:MyData
  43. Main       PROC
  44.  
  45. Start:     ; This is where program execution begins:
  46.            mov  AX,MyData   ; Set up our own data segment address in DS
  47.            mov  DS,AX       ; Can't load segment reg. directly from memory
  48.  
  49.            lea  DX,Eat1     ; Load offset of Eat1 string into DX
  50.            call Writeln     ;   and display it
  51.            lea  DX,Eat2     ; Load offset of Ear2 string into DX
  52.            call Writeln     ;   and display it
  53.  
  54.            mov  AH,4CH      ; Terminate process DOS service
  55.            mov  AL,0        ; Pass this value back to ERRORLEVEL
  56.            int  21H         ; Control returns to DOS
  57.  
  58. ;----------------------------------------|
  59. ;           PROCEDURE SECTION            |
  60. ;----------------------------------------|
  61.  
  62. Write      PROC
  63.            mov AH,09H        ; Select DOS service 9: Print String
  64.            int 21H           ; Call DOS
  65.            ret               ; Return to the caller
  66. Write      ENDP
  67.  
  68.  
  69. Writeln    PROC
  70.            call Write           ; Display the string proper through Write
  71.            mov DX,OFFSET CRLF   ; Load address of newline string to DS:DX
  72.            call Write           ; Display the newline string through Write
  73.            ret                  ; Return to the caller
  74. Writeln    ENDP
  75.  
  76. ;----------------------------------------|
  77. ;        END PROCEDURE SECTION           |
  78. ;----------------------------------------|
  79.  
  80. Main       ENDP
  81.  
  82. MyCode     ENDS
  83.  
  84. ;----------------------------|
  85. ;      END CODE SEGMENT      |
  86. ;----------------------------|
  87.  
  88.            END Start    ; The procedure named Start becomes the main program
  89.